package br.ufal.ic.bean;

import br.ufal.ic.user.User;
import javax.faces.context.FacesContext;

/**
 *
 * @author Marcos Paulo
 */
public class UserBean extends AbstractBean {

    private String nickName;
    private boolean loginOk;
    private User user;

    public UserBean() {
        super();
        loginOk = false;
    }

    public String getNickName() {
        user = (User)FacesContext.getCurrentInstance().getExternalContext().
                getSessionMap().get("user");

        if(user == null) {
            throw new SecurityException();
        }
        nickName = user.getNickName();
        return nickName;
    }

    public void setLoginOk(boolean loginOk) {
        this.loginOk = loginOk;
    }

    public boolean isLoginOk() {
        return loginOk;
    }

}
